﻿<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>删除数组中指定元素</title>
    <script type="text/javascript" language="JavaScript">
        // 自定义数组删除方法
        Array.prototype.del = function (n){
            if(n < 0) return this;
            return this.slice(0,n).concat(this.slice(n + 1,this.length));
        }
        var arr = new Array("1","2","3","4");   // 定义4个元素的数组
        alert(arr.del(1))  //删除数组中第二个元素-从0开始索引
    </script>
</head>
<body>

</body>
</html>